import { IPSAppDERedirectView } from '../../app/view/ipsapp-deredirect-view';
import { IPSModelObject } from '../../ipsmodel-object';
import { PSModelServiceProxyImpl } from '../../psmodel-service-proxy-impl';

/**
 * 全局默认通用代理
 *
 * @author chitanda
 * @date 2021-06-08 20:06:55
 * @export
 * @class PSAppDERedirectViewServiceProxy
 * @extends {PSModelServiceProxyImpl}
 */
export class PSAppDERedirectViewServiceProxy extends PSModelServiceProxyImpl {
  getPSModel4(
    relatedPSModelObject: IPSModelObject,
    cls: string,
    objNode: any,
    strTag: string,
  ): IPSModelObject {
    switch (strTag) {
      case 'getGetDataPSAppDEAction':
        return this.getGetDataPSAppDEAction(
          relatedPSModelObject as IPSAppDERedirectView,
          objNode,
        );
      case 'getTypePSAppDEField':
        return this.getTypePSAppDEField(
          relatedPSModelObject as IPSAppDERedirectView,
          objNode,
        );
    }
    return this.getRealPSModelService().getPSModel4(
      relatedPSModelObject,
      cls,
      objNode,
      strTag,
    );
  }

  getGetDataPSAppDEAction(r: IPSAppDERedirectView, obj: any): any {
    const entity = r.getPSAppDataEntity();
    if (entity) {
      return entity.findPSAppDEAction(obj);
    }
    return null;
  }

  getTypePSAppDEField(r: IPSAppDERedirectView, obj: any): any {
    const entity = r.getPSAppDataEntity();
    if (entity) {
      return entity.findPSAppDEField(obj);
    }
    return null;
  }
}
